package cn.anxin.a9.avplayer;

import android.content.Context;
import android.graphics.PixelFormat;
import android.util.AttributeSet;

public class LiveViewGLMonitor extends AVGLMonitor {

    private Context context;
    private AVCamera camera;

    private boolean muted = false;

    public LiveViewGLMonitor(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;

        this.setKeepScreenOn(true);
    }

    public LiveViewGLMonitor(Context context, AVCamera camera) {
        this(context, camera, null);
    }

    public LiveViewGLMonitor(Context context, AVCamera camera, AttributeSet attrs) {
        this(context, attrs);

        setCamera(camera);
    }

    public void setCamera(AVCamera camera) {
        this.camera = camera;

        camera.setMonitor(this);
        //auto play
        camera.play();
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        //destroy
        camera.stop();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
    }

}
